import { createRouter, createWebHistory } from 'vue-router'
import Layout from '../layout/index.vue'

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Layout,
    redirect: '/download',
    children: [
      {
        path: '/download',
        name: 'Download',
        component: () => import('../views/home.vue'),
        redirect: '/selected',
        meta: { title: '首页' , pageId: 1},
        children: [
          {
            path: '/selected',
            name: 'Selected',
            component: () => import('../views/home/views/selected.vue'),
            meta: { title: '精选', tagId: 1 }
          },
          {
            path: '/playList',
            name: 'PlayList',
            component: () => import('../views/home/views/playListPage.vue'),
            meta: { title: '歌单大厅', tagId: 2 }
          },
          {
            path: '/ranking',
            name: 'Ranking',
            component: () => import('../views/home/views/rankingList.vue'),
            meta: {title: '排行榜' , tagId: 3}
          },
          {
            path: '/songs',
            name: 'Songs',
            component: () => import('../views/home/views/songs.vue'),
            meta: {title: '歌手' , tagId: 4}
          },
          {
            path: '/vip',
            name: 'vip',
            component: () => import('../views/home/views/vip.vue'),
            meta: {title: 'vip' , tagId: 5}
          }
        ]
      }
    ]
  },
  {
    component: Layout,
    redirect: '/newSongs',
    children: [
      {
        path: '/newSongs',
        name: 'NewSongs',
        component: () => import('../views/NewSongs.vue'),
        meta: { title: '新歌速递' , pageId: 15},
      },
      {
        path: '/newDisc',
        name: 'NewDisc',
        component: () => import('../views/NewDisc.vue'),
        meta: { title: '新碟上架' , pageId: 16 }
      }
    ]
  }
]

export const router = createRouter({
  history: createWebHistory(),
  routes: routes
})
